<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="city">
        <button @click="get_weather">点击获取天气</button>
    </div>

    <div id="app2">
        <button @click="get_user">获取用户列表</button>
    </div>

    <script>
        let vm = new Vue({
            el:"#app",
            data:{
                city:"",
            },
            methods:{
                get_weather(){
                    // http://wthrcdn.etouch.cn/weather_mini?city=城市名称
                    axios.get("http://wthrcdn.etouch.cn/weather_mini?city="+this.city)
                        .then(response=>{
                            console.log(response);

                        }).catch(error=>{
                            console.log(error.response)
                    });
                }
            }
        })

        let vm2 = new Vue({
            el: "#app2",
            methods:{
                get_user(){
                    axios.get("http://localhost:3000/api/v1/users?pagesize=2&pagenum=1").then(response=>{
                        console.log(response)
                    }).catch(error=>{
                        console.log(error.response)
                    })
                }
            }
        })
    </script>
</body>
</html>